﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.IO;
using System.Media;
using System.Drawing;

namespace WebService1
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }

        [WebMethod]
        public bool AddRecord(ClienUpLoadDTO cluDTO)
        {
            return ClientUpLoadDAO.AddRecord(cluDTO);
        }

        [WebMethod]
        public bool AddRecordToFeedBack(ClientFeedBackDTO cfbDTO)
        {
            return ClientFeedBackDAO.AddRecordToUpLoad(cfbDTO);
        }

        [WebMethod]
        public bool ReceiveStreamOfVideo(Byte[] bytes, string fileName)
        {
            bool result = false;



            return result;
        }

        [WebMethod]
        public bool ReceiveImage(Byte[] bytes)
        {
            bool result = false;
            
            //Image image;
            //using (MemoryStream inStream = new MemoryStream())
            //{
            //    inStream.Write(imageData, 0, imageData.Length);

            //    image = Bitmap.FromStream(inStream);
            //}
            MemoryStream ms = new MemoryStream(bytes);
            Image returnImage = Image.FromStream(ms);
            

            return result;
        }
    }
}